<?php

class Debugpanel extends App {
	public static function UnInit () {
		global $conf, $messages, $minf_start;
		
		echosys("DEBUG: MEM USAGE : ".round(memory_get_usage()/1024,1).
				" KB ( ".round(memory_get_peak_usage()/1024,1)." KB )", MSG_NOTICE);
		
		// Developer yetkisi arar veya conf'ta debug.force arar 
		if (Auth::Check("developer")||conf('debug.force')=="true") {
			foreach ($messages as $m) {
				$m['time'] = round(($m['time'] - $minf_start) * 1000).".ms";
				$mymsg[] = $m;
			}
			if (conf('debug.panel')=="true")
				Page::Set("minf.messages", $mymsg, "set");
			Page::CSS("debugpanel.css");
			Page::Set("page.append", smarty_render("debugpanel.tpl"));		
		}
	}
	
	public static function RenderMessages ($msgs) {
		Page::Set("debug_messages", $msgs);
		return smarty_render("messages.tpl");
	}
}

?>